package com.infore.common.exception;

import org.springframework.dao.DataAccessException;

public class DaException extends DataAccessException {
    private static final long serialVersionUID = 1L;
    private int errorCode = -1;

    public DaException(final String errorMsg) {
        super(errorMsg);
    }

    public DaException(final String errorMsg, final int errorCode) {
        super(errorMsg);
        this.errorCode = errorCode;
    }

    public static void main(String[] args) {
        try {
            try {
                throw new DaException("test");
            } catch (Exception e) {
                // e.printStackTrace();
                throw new DaException(e.getMessage());
            }
        } catch (DaException e) {
            // e.printStackTrace();
            System.out.println(e.getMessage());
        }
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
}
